<template>
  <div>
      <input type="button" @click="addCount" value="ok">
      <p>p:{{count}}</p>
      <p>p:{{myCount}}</p>
    
  </div>
</template>

<script>
// 导入store的State和getters,得到count和myCount
import {mapState,mapGetters} from 'vuex'
//导入mutations 得到其方法
import {mapMutations,mapActions} from 'vuex'
export default {
    computed:{
     ...mapState(["count"]),//...拓展运算符，将mapState展开当作一个键，‘count’为值
      ...mapGetters(['myCount']),  
    },
   methods:{
 
       addCount(){
        this.increment()
       },
       ...mapMutations(['increment']),
   }
}
</script>

<style>

</style>